package com.gugee.tiktok.common.model.dto;

import com.gugee.tiktok.common.model.mysql.Blogger;
import com.gugee.tiktok.common.model.spider.aweme.SlimAuthor;
import com.gugee.tiktok.common.model.spider.blogger.SlimUser;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.springframework.data.relational.core.mapping.Table;

import java.util.List;

@Data
@Table
public class SlimBloggerDto {
    private long id;
    private long uid;
    private String region;

    @Mapper(componentModel = "spring")
    public interface SlimBloggerDtoMapper {

        SlimBloggerDto mapperUser(SlimUser dto);

        List<SlimBloggerDto> mapperUser(List<SlimUser> dtos);

        SlimBloggerDto mapperAuthor(SlimAuthor dto);

        List<SlimBloggerDto> mapperAuthor(List<SlimAuthor> dtos);

        @Mapping(target = "uid", source = "OUid")
        @Mapping(target = "region", source = "ORegion")
        SlimBloggerDto mapperBlogger(Blogger blogger);

        List<SlimBloggerDto> mapperBlogger(List<Blogger> blogger);
    }
}
